Common Cathode configuration:
Common Anode configuration:
Applications
/* Name : main.c
* Purpose : Source code for SEVEN SEGMENT Interfacing with ARM LPC1248.
* Author : Gemicates
* Date : 2018-11-01
* Website : www.gemicates.org
* Revision : None
*/
#include<lpc21xx.h> // header file for LPC21XX series
void delay(int time) // delay function declaration
{ // This function produces a delay in msec
int i,j;
for(i=0;i<time;i++)
{
for(j=0;j<i;j++);
}
}
int main() // main function
{
int i,a[]={0x40,0x79,0x24,0x30,0x19,0x12,0x02,0x78,0x00,0x10,0x00,0x10}; // assign the array values as the hexadecimal no. of common anode to display the digits
PINSEL0=0x00000000; // select PORT0 as GPIO mode
IO0DIR=0xFFFFFFFF; // make PORT0 pin as Output mode
while(1) // Repeat(loop) forever
{
for(i=0;i<10;i++) // This loop excutes for 9 times
{
IO0SET=a[i]; // Set the first 8 PORT0 pins
delay(1000); // hault for sometime
IO0CLR=a[i]; // clear the first 8 PORT0 pins
}
}
return 0; // return back to main function
}